﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
using ERMap;
namespace PhoneBook.Manage
{
    public class OperatorLog
    {
        public static DataSet listoperatorlog(string modulename, string username, DateTime starttime, DateTime endtime)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("select OperatorLog.*,sys_users.usertype,sys_users.username from OperatorLog left join sys_users on OperatorLog.userid=sys_users.userid");
            sb.Append(" where 1=1 and modulename like @modulename and (sys_users.username like @username or OperatorLog.loginid  like @username) and OperDate between @starttime and @endtime");
            sb.Append("  order by OperDate desc ");

            Hashtable param = new Hashtable();
            param["modulename"] = "%" + modulename + "%";
            param["username"] = "%" + username + "%";
            param["starttime"] = starttime;
            param["endtime"] = endtime;

            return ERMapHelper.getCustomData(sb.ToString(), param);
        }

        public static void add(Hashtable newOperatorLog)
        {
            ERMapHelper.setmodel("OperatorLog", "Id", newOperatorLog);
        }
    }
}
